(function(){
	let Pipe = window.Pipe = function(){
		this.w = 52;
		this.h = 520;
		//从右往左跑
		this.x = game.canvas.width;
		this.speed = 2;
		//上管长度
		this.height1 = 50 + parseInt(Math.random() * 300);
		//间隙长度
		this.limitHeight = 100;
		//下管长度
		this.height2 = game.canvas.height * 0.75 - this.height1 - this.limitHeight;
		game.pipeArr.push(this);
	}
	
	Pipe.prototype.init = function(){
		game.ctx.drawImage(game.R.pipe_down,0,this.h - this.height1,this.w,this.height1,this.x,0,this.w,this.height1);
		game.ctx.drawImage(game.R.pipe_up,0,0,this.w,this.height2,this.x,this.height1 + this.limitHeight,this.w,this.height2);
	}
	
	Pipe.prototype.move = function(){
		this.x -= this.speed;
	}
})();